﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ATest.Bll;

namespace ATest.Helpers
{
    public static class ModelStateHelpers
    {
        public static void AddModelErrors(this ModelStateDictionary modelState, IEnumerable<RuleViolation> errors)
        {
            errors.ToList().ForEach(error => modelState.AddModelError(error.PropertyName, error.ErrorMessage));
        }
    }
}
